package org.example.myleet.segmenttree;

public class Segment {
    //线段范围内的值
    int v;
    //线段范围内的值变更标签
    int add;
    //线段范围边界
    int l;
    int r;
    //线段范围中间点
    int mid;
    //子线段节点，[l,mid]和[mid+1,r]
    Segment left;
    Segment right;

    public Segment(int l, int r) {
        this.l = l;
        this.r = r;
        this.mid = (l + r) >> 1;
        this.v = 0;
        this.add = 0;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Segment{");
        sb.append("v=").append(v);
        sb.append(", add=").append(add);
        sb.append(", l=").append(l);
        sb.append(", r=").append(r);
        sb.append(", mid=").append(mid);
        sb.append('}');
        return sb.toString();
    }
}
